<?php namespace App\Commands;

use App\Commands\Command;

use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Bus\SelfHandling;
use Illuminate\Contracts\Queue\ShouldBeQueued;

use Log;
use Sendcloud;

class SendEmail extends Command implements SelfHandling, ShouldBeQueued {

	use InteractsWithQueue, SerializesModels;

	/**
	 * Create a new command instance.
	 *
	 * @return void
	 */
	public function __construct()
	{
		//
	}

	/**
	 * Execute the command.
	 *
	 * @return void
	 */
	public function handle()
	{
		//
	}

	public function fire($job, $data)
	{
		$res = Sendcloud::send($data["to"], $data["title"], $data["content"]);
		//Sendcloud::send('test@test.com','来自SendCloud的第一封邮件!',(string)(View::make('test')));
		Log::info($res . " and content is:" . $data["content"]);
		return $res;
	}

}
